# -*- coding: UTF-8 -*-
import logging
import logging.handlers

logger = logging.getLogger("lj")

handler1 = logging.StreamHandler()
handler2 = logging.handlers.TimedRotatingFileHandler(
    "log/test.log", when="H", interval=12, backupCount=10, encoding="utf-8")

logger.setLevel(logging.DEBUG)
handler1.setLevel(logging.DEBUG)
handler2.setLevel(logging.DEBUG)

formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s %(message)s")
handler1.setFormatter(formatter)
handler2.setFormatter(formatter)

logger.addHandler(handler1)
logger.addHandler(handler2)

log = logger

debug = logger.debug
info = logger.info
warning = logger.warning
error = logger.error
critical = logger.critical

info("LJ - 日志模块初始化完成...")
